#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/3/8 17:31
# @Author  : jeff
# @FileName: read_config
from src.utils.sys_yaml_common import application_value
mysql = application_value(value="application.mysql")
redis = application_value(value="application.redis")
thread_pool = application_value(value="application.thread_pool")


def db_config():
    return (
        mysql['HOSTNAME'],
        mysql['PORT'],
        mysql['USERNAME'],
        mysql['PASSWORD'],
        mysql['DATABASE']
    )


def redis_config():
    return (
        redis['HOSTNAME'],
        redis['PORT'],
        redis['PASSWORD'],
    )


def thread_pool_config():
    return (
        thread_pool['max_workers'],
        thread_pool['wait_for_workers'],
        thread_pool['timeout']
    )


def app_config():
    return (
        application_value(value="application.host"),
        application_value(value="application.port"),
        application_value(value="application.debug"),
        application_value(value="application.use_reloader"),
    )


def authentication_config():
    return (application_value(value="application.authentication.redis_switch"),
            application_value(value="application.authentication.time"),
            application_value(value="application.authentication.secret_key"),
            )

